//
//  TrackInfo.m
//  Hive
//
//  Created by 惠俊贝 on 15/9/14.
//  Copyright (c) 2015年 ZM. All rights reserved.
//

#import "TrackInfo.h"
#import "GaodeTransform.h"
#import "LonLat.h"

@implementation TrackInfo
+ (TrackInfo *)createTrackInfoWithDic:(NSDictionary *)dic {
    TrackInfo *ti = [[TrackInfo alloc] init];
    ti.BLat = [dic objectForKey:@"BLat"];
    ti.BLng = [dic objectForKey:@"BLng"];
    ti.lat = [dic objectForKey:@"lat"];
    ti.lng = [dic objectForKey:@"lng"];
    ti.Type = [dic objectForKey:@"Type"];
    ti.Speed = [dic objectForKey:@"Speed"];
    ti.PositionTime = [dic objectForKey:@"PositionTime"];
    
    LonLat *aLonlat = [GaodeTransform transform:[ti.lat doubleValue] :[ti.lng doubleValue]];
    ti.GDLat = aLonlat.lat;//高德经度
    ti.GDLng = aLonlat.lon;//高德纬度
    return ti;
}

+ (NSArray *)createTrackInfosWithDicArray:(NSArray *)arr {
    NSMutableArray *rs = [[NSMutableArray alloc] init];
    for ( NSDictionary *dic in arr) {
        [rs addObject:[TrackInfo createTrackInfoWithDic:dic]];
    }
    return rs;
}
@end
